<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <!-- 1. 引入第三方 swiper的样式和js -->
    <link rel="stylesheet" href="../swiper/swiper-bundle.min.css">
    <script src="../swiper/swiper-bundle.min.js"></script>
    <style>
        /* 3.你可能想要给Swiper定义一个大小，当然不要也行。 */
        .mySwiper {
            width: 1226px;
            /* height: 400px; */
        }

        .mySwiper .swiper-wrapper .swiper-slide img {
            width: 100%;
        }
    </style>
</head>

<body>
    <!-- 2.添加HTML内容。Swiper7的默认容器是'.swiper'，Swiper6之前是'.swiper-container'。 -->
    <div class="swiper mySwiper">
        <div class="swiper-wrapper">
            <!-- <div class="swiper-slide">Slide 1</div>
            <div class="swiper-slide">Slide 2</div>
            <div class="swiper-slide">Slide 3</div> -->
            <div class="swiper-slide"><img src="../images/1.webp" alt=""></div>
            <div class="swiper-slide"><img src="../images/2.webp" alt=""></div>
            <div class="swiper-slide"><img src="../images/3.jpg" alt=""></div>
            <div class="swiper-slide"><img src="../images/4.webp" alt=""></div>

        </div>
        <!-- 如果需要分页器(导航) -->
        <div class="swiper-pagination"></div>

        <!-- 如果需要导航按钮 -->
        <div class="swiper-button-prev"></div>
        <div class="swiper-button-next"></div>

        <!-- 如果需要滚动条 -->
        <!-- <div class="swiper-scrollbar"></div> -->
    </div>
</body>
<script>
    //  new Swiper(selector,options)   创建轮播
    //  selector  css选择器(轮播的容器名)
    //  options   轮播的相关配置

    var mySwiper = new Swiper('.swiper', {
        // direction: 'vertical', // 垂直切换选项
        direction: 'horizontal', // 默认水平切换选项
        loop: true, // 循环模式选项

        // 如果需要分页器
        pagination: {
            el: '.swiper-pagination',   //分页器的class名
        },

        // 如果需要前进后退按钮
        navigation: {
            nextEl: '.swiper-button-next',   //左右切换的class名
            prevEl: '.swiper-button-prev',
        },

        // 如果需要滚动条
        scrollbar: {
            el: '.swiper-scrollbar',
        },
    })



</script>

</html>